using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class TabMe
    {   
		public ScrollRect ScrollRect;
		public CButton CellInfo;
		public CButton CellContact;
		public CButton CellMyTrain;
		public CButton CellExpo;
		public CButton CellWithdraw;
		public CButton CellInvite;
		public CButton FAQ;
		public CButton AbountUs;
		public Switch SwitchPushMsg;
		public CButton Language;
		public CButton Version;
		public CButton BtnLogout;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			ScrollRect = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<ScrollRect>();
			CellInfo = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellContact = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellMyTrain = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellExpo = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellWithdraw = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			CellInvite = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			FAQ = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			AbountUs = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			SwitchPushMsg = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Switch>();
			Language = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Version = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnLogout = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_version { get { return i18n.GetTextByKey("version"); } }
		public string I18N_curr_is_latest_version { get { return i18n.GetTextByKey("curr_is_latest_version"); } }
    }
}
